<template>
    <div>
        <el-breadcrumb separator-class="el-icon-arrow-right" style="margin-bottom: 15px; font-size: 12px">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>管理员管理</el-breadcrumb-item>
            <el-breadcrumb-item>管理员列表</el-breadcrumb-item>
        </el-breadcrumb>
        <el-card style="box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) !important;">
            <el-table
                    :data="tableData"
                    border
                    style="width: 100%">
                <el-table-column
                        fixed
                        prop="id"
                        label="ID"
                        width="60">
                </el-table-column>
                <el-table-column
                        prop="account"
                        label="账号"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="name"
                        label="姓名"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="address"
                        label="地址"
                        width="120">
                </el-table-column>
                <el-table-column
                        label="操作"
                        width="80">
                    <template slot-scope="scope">
                        <el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini"></el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-card>
    </div>
</template>

<script>
    export default {
        methods:{
            edit(row) {
                this.$router.push({
                    path: '/editAdmin',
                    query: {
                        id: row.id
                    }
                })
            }
        },
        created() {
            const _this = this
            axios.get('http://localhost:8181/admin/findAll').then(function (resp) {
                _this.tableData = resp.data
            })
        },
        data() {
            return {
                tableData: null
            }
        }
    }
</script>